<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./tool.js"></script>
    <title>Document</title>
</head>

<body>

    <script>
        fetch('http://106.13.233.100:3002/getAll', {}).then(response => {
            if (response.status >= 200 && response.status < 300) { // 判断请求是否成功
                return response.json() // 得到 JSON 对象
            } else {
                throw new Error(response.statusText);
            }
        }).then(json => {
            let money = 100, minMoney = money;
            let dd = 0; // 独胆
            let testData = {}, num = 0
            for (let index = 0; index < 10; index++)  testData[index] = 0;
            let succAndFai = [0, 0]
            json.forEach((item) => {
                let flag = true;
                Object.keys(item).forEach((key) => {
                    if (key == 'createDate' || key == 'issueNo' || key == 'id') return;
                    if (item[key] == dd) {
                        money += 8.8
                        flag = false
                        succAndFai[0]++
                    }
                    else {
                        succAndFai[1]++
                        money -= 1
                    }
                    if (minMoney > money) minMoney = money;
                })
                if (flag) {
                    num++
                } else {
                    testData[num] = (testData[num] || 0) + 1
                    num = 0
                }
                dd = Math.abs(item.one - item.two)
            })
            // console.log(json);  // 得到最终结果。
            console.log('用上期时时彩开奖号码的万位与千位之间的正差值作为毒胆。',)
            console.log('盈利 ', money, '最小金额为 ', minMoney)
            console.log('统计预测定胆间隔多少次成功的数据', testData)
            console.log('统计预测定胆成功和失败的次数', succAndFai, '盈利为', succAndFai[0] * 8.8 - succAndFai[1])
            console.log('上面的是不倍投，一直固定金额 ---- 失败了',)


            maxMoney = minMoney = money = 100, dd = 0
            let bt = [1, 3, 7], btNum = 0
            json.forEach((item) => {
                flag = false
                Object.keys(item).forEach((key) => {
                    if (key == 'createDate' || key == 'issueNo' || key == 'id') return;
                    if (item[key] == dd) {
                        money += 8.8 * bt[btNum]
                        flag = true
                    }
                    else {
                        money -= 1 * bt[btNum]
                    }
                    if (minMoney > money) minMoney = money;
                    if (maxMoney < money) maxMoney = money;
                })
                dd = Math.abs(item.one - item.two)
                if (flag) {
                    btNum = 0
                } else {
                    btNum++
                }
                if (btNum > 2) btNum = 0
            })
            console.log('盈利 ', money, '最小金额为 ', minMoney, '最大金额为', maxMoney)
            console.log('上面的是倍投， ---- 失败了',)
        }).catch(err => {
            console.log('Request Failed', err)
        });
        console.log('', new Date("2022-06-05T02:11:04.000Z"))
    </script>
</body>

</html>